Skip to content

Add changelog synthesis helper#19

Closed
laurenceputra wants to merge 1 commit into
mainfrom
feature/changelog-synth
Closed

Add changelog synthesis helper#19
laurenceputra wants to merge 1 commit into
mainfrom
feature/changelog-synth

Conversation

@laurenceputra
Copy link
Copy Markdown
Owner

Summary

  • add a maintainer-only changelog synthesis script for explicit git ref ranges
  • cover the synthesizer with deterministic integration tests using temporary git fixtures
  • document the helper and note it in the changelog

Testing

  • bash -n scripts/generate_changelog.sh
  • bash -n .codex_yolo.sh
  • ./tests/integration_tests.sh

Nightshift-Task: changelog-synth
Nightshift-Ref: https://github.com/marcus/nightshift
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a maintainer-oriented helper for synthesizing a Keep a Changelog-style draft section from an explicit git ref range, plus deterministic integration tests and documentation updates to support the workflow.

Changes:

  • Introduce scripts/generate_changelog.sh to bucket commit subjects into Added/Changed/Fixed/Security sections for a --from .. --to range.
  • Extend tests/integration_tests.sh with deterministic git-fixture integration tests for grouped output and empty-range output.
  • Document the helper in README.md / TECHNICAL.md and note it in CHANGELOG.md.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/integration_tests.sh Adds execute/syntax checks for the new script and two deterministic changelog synthesis integration tests.
scripts/generate_changelog.sh New changelog synthesis script that parses refs, normalizes subjects, buckets entries, and prints markdown.
TECHNICAL.md Documents the changelog synthesis helper and updates the integration test list/description.
README.md Adds maintainer-facing instructions for generating changelog drafts from git ranges.
CHANGELOG.md Notes the addition of the changelog synthesis helper under Unreleased.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +445 to +448
output="$(
cd "${test_repo}" &&
"${CHANGELOG_SCRIPT}" --from "${base_commit}" --to "${head_commit}"
)"
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the test runner uses set -euo pipefail, the command substitutions that generate output will cause the entire integration test script to exit immediately if cd or the changelog script returns non-zero. That bypasses log_fail and makes debugging harder. Consider capturing the exit status (e.g., temporarily disabling -e or using || true) and explicitly failing the test with a helpful message when the synthesizer exits non-zero.

Suggested change
output="$(
cd "${test_repo}" &&
"${CHANGELOG_SCRIPT}" --from "${base_commit}" --to "${head_commit}"
)"
if ! output="$(
cd "${test_repo}" &&
"${CHANGELOG_SCRIPT}" --from "${base_commit}" --to "${head_commit}"
)"; then
status=$?
echo -e "${RED}Changelog generation failed with status ${status} for range ${base_commit}..${head_commit}${NC}" >&2
log_fail "Changelog generation failed with status ${status} for range ${base_commit}..${head_commit}"
fi

Copilot uses AI. Check for mistakes.
Comment on lines +503 to +506
output="$(
cd "${test_repo}" &&
"${CHANGELOG_SCRIPT}" --from "${head_commit}" --to "${head_commit}"
)"
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same set -e concern as the previous test: if the changelog script errors for an empty range, this command substitution will terminate the whole test suite rather than recording a failed assertion. Capture the exit code/output in a way that allows log_fail to run and report the failure cleanly.

Copilot uses AI. Check for mistakes.
subject="${subject%.}"

if [[ -n "${subject}" ]]; then
subject="${subject^}"
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${subject^} is a Bash 4+ expansion. On macOS, /usr/bin/env bash often resolves to Bash 3.2, which will fail with bad substitution and break the script. Either avoid this expansion (use a portable capitalization approach) or explicitly document/enforce a minimum Bash version at runtime (with a clear error).

Suggested change
subject="${subject^}"
# Capitalize the first character in a Bash 3-compatible way
local first_char rest upper_first
first_char=${subject:0:1}
rest=${subject:1}
upper_first=$(printf '%s' "${first_char}" | tr '[:lower:]' '[:upper:]')
subject="${upper_first}${rest}"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants